package com.yyh.io2;

import java.io.*;

/*对象流*/
public class Test2 {
    public static void main1(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("D:\\ideaproject\\IO-code\\IO-code-02\\src\\com\\yyh\\file\\a.txt"));
        Student1 s1 = (Student1) ois.readObject();
        //s1.setName("lisi");
        System.out.println(s1);
        ois.close();
    }
    public static void main(String[] args) throws IOException {
        Student1 s1 = new Student1("张三", 18,20.3,"学府大道");
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("D:\\ideaproject\\IO-code\\IO-code-02\\src\\com\\yyh\\file\\a.txt"));
        oos.writeObject(s1);
        oos.close();
    }
}
